<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:th="http://www.thymeleaf.org" xmlns:sec="http://www.thymeleaf.org/thymeleaf-extras-springsecurity4">
<head th:fragment="head">
    <meta charset="utf-8"/>
    <meta http-equiv="X-UA-Compatible" content="IE=edge"/>
    <title>Ruifu PLS</title>
    <!-- Tell the browser to be responsive to screen width -->
    <meta content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no" name="viewport"/>
    <!-- Bootstrap 3.3.6 -->
    <link rel="stylesheet" th:href="@{/bootstrap/css/bootstrap.min.css}" />
    <!-- Font Awesome -->
    <!-- link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.5.0/css/font-awesome.min.css"/ -->
    <link href="//cdn.bootcss.com/font-awesome/4.2.0/css/font-awesome.min.css" rel="stylesheet"/>
    <!-- Ionicons -->
    <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/ionicons/2.0.1/css/ionicons.min.css"/>


    <!-- Theme style -->
    <link rel="stylesheet" th:href="@{/dist/css/AdminLTE.min.css}"/>
    <link rel="stylesheet" th:href="@{/dist/css/sweetalert2.min.css}"/>
    <!-- AdminLTE Skins. We have chosen the skin-blue for this starter
          page. However, you can choose any other skin. Make sure you
          apply the skin class to the body tag so the changes take effect.
    -->
    <link rel="stylesheet" th:href="@{/dist/css/skins/skin-red.min.css}"/>

    <link rel="stylesheet" th:href="@{/plugins/daterangepicker/daterangepicker.css}" />
    <!-- HTML5 Shim and Respond.js IE8 support of HTML5 elements and media queries -->
    <!-- WARNING: Respond.js doesn't work if you view the page via file:// -->
    <!--[if lt IE 9]>
    <script src="https://oss.maxcdn.com/html5shiv/3.7.3/html5shiv.min.js"></script>
    <script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script>
    <![endif]-->
</head>
<body class="hold-transition skin-red sidebar-mini" ng-app="pls">
<div class="wrapper">

    <navigation th:fragment="header">
    <controller>
    <!-- MGlHeaderader -->
        <header class="main-header">
            <nav class="navbar navbar-static-top">
                <div class="container">
                    <div class="navbar-header">
                        <a href="#" class="navbar-brand"><b>PLS</b></a>
                        <button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#navbar-collapse">
                            <i class="fa fa-bars"></i>
                        </button>
                    </div>

                    <!-- Collect the nav links, forms, and other content for toggling -->
                    <div class="collapse navbar-collapse pull-left" id="navbar-collapse">
                        <ul class="nav navbar-nav">
                            <li class="dropdown">
                                <a href="#" class="dropdown-toggle" data-toggle="dropdown">接口<span class="caret"></span></a>
                                <ul class="dropdown-menu" role="menu">
                                    <li><a href="/interface/taskDesc">任务描述管理</a></li>
                                    <li><a href="/interface/task">当前任务查询</a></li>
                                    <li><a href="/interface/taskBackup">历史任务查询</a></li>
                                    <li><a href="/interface/material">物料基础信息</a></li>
                                    <li><a href="/excelManage/task">任务管理</a></li>
                                </ul>
                            </li>
                        </ul>
                    </div>
                    <!-- /.navbar-collapse -->
                    <!-- /.navbar-custom-menu -->
                </div>
                <!-- /.container-fluid -->
            </nav>
        </header>
    <!-- Left side column. contains the logo and sidebar -->
    </controller>
    </navigation>



    <!-- Content Wrapper. Contains page content -->
    <div class="content-wrapper">
        <!-- ContGlHeaderader (Page header) -->
        <section class="content-header">
            <h1>
                工作列表
                <small>当前工作内容</small>
            </h1>
            <ol class="breadcrumb">
                <li><a href="#"><i class="fa fa-dashboard"></i> Home</a></li>
                <li class="active">Dashboard</li>
            </ol>
        </section>

        <!-- Main content -->
        <section class="content">

            <!-- Your Page Content Here -->
            <div class="row" ng-controller="DashboardController">
                <div class="col-md-3">
                    <a href="compose.html" class="btn btn-primary btn-block margin-bottom">{{title}}</a>

                    <div class="box box-solid">
                        <div class="box-header with-border">
                            <h3 class="box-title">Events</h3>

                            <div class="box-tools">
                                <button type="button" class="btn btn-box-tool" data-widget="collapse"><i class="fa fa-minus"></i>
                                </button>
                            </div>
                        </div>
                        <div class="box-body no-padding">
                            <ul class="nav nav-pills nav-stacked">
                                <li class="active" ng-repeat="event in events">
                                    <a href="#"><i class="fa fa-inbox"></i> {{event.description}}
                                        <span class="label label-primary pull-right">0</span></a></li>

                            </ul>
                        </div>
                        <!-- /.box-body -->
                    </div>
                    <!-- /. box -->
                    <div class="box box-solid">
                        <div class="box-header with-border">
                            <h3 class="box-title">Labels</h3>

                            <div class="box-tools">
                                <button type="button" class="btn btn-box-tool" data-widget="collapse"><i class="fa fa-minus"></i>
                                </button>
                            </div>
                        </div>
                        <div class="box-body no-padding">
                            <ul class="nav nav-pills nav-stacked">
                                <li><a href="#"><i class="fa fa-circle-o text-red"></i> Important</a></li>
                                <li><a href="#"><i class="fa fa-circle-o text-yellow"></i> Promotions</a></li>
                                <li><a href="#"><i class="fa fa-circle-o text-light-blue"></i> Social</a></li>
                            </ul>
                        </div>
                        <!-- /.box-body -->
                    </div>
                    <!-- /.box -->
                    <div class="box box-solid">
                        <input ng-model="event.description" class="form-control" type="text" />
                        <Button class="button btn-primary" ng-click="addEvent($event)">Save</Button>
                    </div>
                </div>
                <!-- /.col -->
                <div class="col-md-9">
                    <div class="box box-primary">
                        <div class="box-header with-border">
                            <h3 class="box-title">Inbox</h3>

                            <div class="box-tools pull-right">
                                <div class="has-feedback">
                                    <input type="text" class="form-control input-sm" placeholder="Search Mail"/>
                                    <span class="glyphicon glyphicon-search form-control-feedback"></span>
                                </div>
                            </div>
                            <!-- /.box-tools -->
                        </div>
                        <!-- /.box-header -->
                        <div class="box-body no-padding">
                            <div class="mailbox-controls">
                                <!-- Check all button -->
                                <button type="button" class="btn btn-default btn-sm checkbox-toggle"><i class="fa fa-square-o"></i>
                                </button>
                                <div class="btn-group">
                                    <button type="button" class="btn btn-default btn-sm"><i class="fa fa-trash-o"></i></button>
                                    <button type="button" class="btn btn-default btn-sm"><i class="fa fa-reply"></i></button>
                                    <button type="button" class="btn btn-default btn-sm"><i class="fa fa-share"></i></button>
                                </div>
                                <!-- /.btn-group -->
                                <button type="button" class="btn btn-default btn-sm"><i class="fa fa-refresh"></i></button>
                                <div class="pull-right">
                                    1-50/200
                                    <div class="btn-group">
                                        <button type="button" class="btn btn-default btn-sm"><i class="fa fa-chevron-left"></i></button>
                                        <button type="button" class="btn btn-default btn-sm"><i class="fa fa-chevron-right"></i></button>
                                    </div>
                                    <!-- /.btn-group -->
                                </div>
                                <!-- /.pull-right -->
                            </div>
                            <div class="table-responsive mailbox-messages">
                                <table class="table table-hover table-striped">
                                    <tbody>
                                    <tr>
                                        <td><input type="checkbox"/></td>
                                        <td class="mailbox-star"><a href="#"><i class="fa fa-star text-yellow"></i></a></td>
                                        <td class="mailbox-name"><a href="read-mail.html">Alexander Pierce</a></td>
                                        <td class="mailbox-subject"><b>AdminLTE 2.0 Issue</b> - Trying to find a solution to this problem...
                                        </td>
                                        <td class="mailbox-attachment"></td>
                                        <td class="mailbox-date">5 mins ago</td>
                                    </tr>
                                    <tr>
                                        <td><input type="checkbox"/></td>
                                        <td class="mailbox-star"><a href="#"><i class="fa fa-star-o text-yellow"></i></a></td>
                                        <td class="mailbox-name"><a href="read-mail.html">Alexander Pierce</a></td>
                                        <td class="mailbox-subject"><b>AdminLTE 2.0 Issue</b> - Trying to find a solution to this problem...
                                        </td>
                                        <td class="mailbox-attachment"><i class="fa fa-paperclip"></i></td>
                                        <td class="mailbox-date">28 mins ago</td>
                                    </tr>
                                    <tr>
                                        <td><input type="checkbox"/></td>
                                        <td class="mailbox-star"><a href="#"><i class="fa fa-star-o text-yellow"></i></a></td>
                                        <td class="mailbox-name"><a href="read-mail.html">Alexander Pierce</a></td>
                                        <td class="mailbox-subject"><b>AdminLTE 2.0 Issue</b> - Trying to find a solution to this problem...
                                        </td>
                                        <td class="mailbox-attachment"><i class="fa fa-paperclip"></i></td>
                                        <td class="mailbox-date">11 hours ago</td>
                                    </tr>
                                    <tr>
                                        <td><input type="checkbox"/></td>
                                        <td class="mailbox-star"><a href="#"><i class="fa fa-star text-yellow"></i></a></td>
                                        <td class="mailbox-name"><a href="read-mail.html">Alexander Pierce</a></td>
                                        <td class="mailbox-subject"><b>AdminLTE 2.0 Issue</b> - Trying to find a solution to this problem...
                                        </td>
                                        <td class="mailbox-attachment"></td>
                                        <td class="mailbox-date">15 hours ago</td>
                                    </tr>
                                    <tr>
                                        <td><input type="checkbox"/></td>
                                        <td class="mailbox-star"><a href="#"><i class="fa fa-star text-yellow"></i></a></td>
                                        <td class="mailbox-name"><a href="read-mail.html">Alexander Pierce</a></td>
                                        <td class="mailbox-subject"><b>AdminLTE 2.0 Issue</b> - Trying to find a solution to this problem...
                                        </td>
                                        <td class="mailbox-attachment"><i class="fa fa-paperclip"></i></td>
                                        <td class="mailbox-date">Yesterday</td>
                                    </tr>
                                    <tr>
                                        <td><input type="checkbox"/></td>
                                        <td class="mailbox-star"><a href="#"><i class="fa fa-star-o text-yellow"></i></a></td>
                                        <td class="mailbox-name"><a href="read-mail.html">Alexander Pierce</a></td>
                                        <td class="mailbox-subject"><b>AdminLTE 2.0 Issue</b> - Trying to find a solution to this problem...
                                        </td>
                                        <td class="mailbox-attachment"><i class="fa fa-paperclip"></i></td>
                                        <td class="mailbox-date">2 days ago</td>
                                    </tr>
                                    <tr>
                                        <td><input type="checkbox"/></td>
                                        <td class="mailbox-star"><a href="#"><i class="fa fa-star-o text-yellow"></i></a></td>
                                        <td class="mailbox-name"><a href="read-mail.html">Alexander Pierce</a></td>
                                        <td class="mailbox-subject"><b>AdminLTE 2.0 Issue</b> - Trying to find a solution to this problem...
                                        </td>
                                        <td class="mailbox-attachment"><i class="fa fa-paperclip"></i></td>
                                        <td class="mailbox-date">2 days ago</td>
                                    </tr>
                                    <tr>
                                        <td><input type="checkbox"/></td>
                                        <td class="mailbox-star"><a href="#"><i class="fa fa-star text-yellow"></i></a></td>
                                        <td class="mailbox-name"><a href="read-mail.html">Alexander Pierce</a></td>
                                        <td class="mailbox-subject"><b>AdminLTE 2.0 Issue</b> - Trying to find a solution to this problem...
                                        </td>
                                        <td class="mailbox-attachment"></td>
                                        <td class="mailbox-date">2 days ago</td>
                                    </tr>
                                    <tr>
                                        <td><input type="checkbox"/></td>
                                        <td class="mailbox-star"><a href="#"><i class="fa fa-star text-yellow"></i></a></td>
                                        <td class="mailbox-name"><a href="read-mail.html">Alexander Pierce</a></td>
                                        <td class="mailbox-subject"><b>AdminLTE 2.0 Issue</b> - Trying to find a solution to this problem...
                                        </td>
                                        <td class="mailbox-attachment"></td>
                                        <td class="mailbox-date">2 days ago</td>
                                    </tr>
                                    <tr>
                                        <td><input type="checkbox"/></td>
                                        <td class="mailbox-star"><a href="#"><i class="fa fa-star-o text-yellow"></i></a></td>
                                        <td class="mailbox-name"><a href="read-mail.html">Alexander Pierce</a></td>
                                        <td class="mailbox-subject"><b>AdminLTE 2.0 Issue</b> - Trying to find a solution to this problem...
                                        </td>
                                        <td class="mailbox-attachment"></td>
                                        <td class="mailbox-date">2 days ago</td>
                                    </tr>
                                    <tr>
                                        <td><input type="checkbox"/></td>
                                        <td class="mailbox-star"><a href="#"><i class="fa fa-star-o text-yellow"></i></a></td>
                                        <td class="mailbox-name"><a href="read-mail.html">Alexander Pierce</a></td>
                                        <td class="mailbox-subject"><b>AdminLTE 2.0 Issue</b> - Trying to find a solution to this problem...
                                        </td>
                                        <td class="mailbox-attachment"><i class="fa fa-paperclip"></i></td>
                                        <td class="mailbox-date">4 days ago</td>
                                    </tr>
                                    <tr>
                                        <td><input type="checkbox"/></td>
                                        <td class="mailbox-star"><a href="#"><i class="fa fa-star text-yellow"></i></a></td>
                                        <td class="mailbox-name"><a href="read-mail.html">Alexander Pierce</a></td>
                                        <td class="mailbox-subject"><b>AdminLTE 2.0 Issue</b> - Trying to find a solution to this problem...
                                        </td>
                                        <td class="mailbox-attachment"></td>
                                        <td class="mailbox-date">12 days ago</td>
                                    </tr>
                                    <tr>
                                        <td><input type="checkbox"/></td>
                                        <td class="mailbox-star"><a href="#"><i class="fa fa-star-o text-yellow"></i></a></td>
                                        <td class="mailbox-name"><a href="read-mail.html">Alexander Pierce</a></td>
                                        <td class="mailbox-subject"><b>AdminLTE 2.0 Issue</b> - Trying to find a solution to this problem...
                                        </td>
                                        <td class="mailbox-attachment"><i class="fa fa-paperclip"></i></td>
                                        <td class="mailbox-date">12 days ago</td>
                                    </tr>
                                    <tr>
                                        <td><input type="checkbox"/></td>
                                        <td class="mailbox-star"><a href="#"><i class="fa fa-star text-yellow"></i></a></td>
                                        <td class="mailbox-name"><a href="read-mail.html">Alexander Pierce</a></td>
                                        <td class="mailbox-subject"><b>AdminLTE 2.0 Issue</b> - Trying to find a solution to this problem...
                                        </td>
                                        <td class="mailbox-attachment"><i class="fa fa-paperclip"></i></td>
                                        <td class="mailbox-date">14 days ago</td>
                                    </tr>
                                    <tr>
                                        <td><input type="checkbox"/></td>
                                        <td class="mailbox-star"><a href="#"><i class="fa fa-star text-yellow"></i></a></td>
                                        <td class="mailbox-name"><a href="read-mail.html">Alexander Pierce</a></td>
                                        <td class="mailbox-subject"><b>AdminLTE 2.0 Issue</b> - Trying to find a solution to this problem...
                                        </td>
                                        <td class="mailbox-attachment"><i class="fa fa-paperclip"></i></td>
                                        <td class="mailbox-date">15 days ago</td>
                                    </tr>
                                    </tbody>
                                </table>
                                <!-- /.table -->
                            </div>
                            <!-- /.mail-box-messages -->
                        </div>
                        <!-- /.box-body -->
                        <div class="box-footer no-padding">
                            <div class="mailbox-controls">
                                <!-- Check all button -->
                                <button type="button" class="btn btn-default btn-sm checkbox-toggle"><i class="fa fa-square-o"></i>
                                </button>
                                <div class="btn-group">
                                    <button type="button" class="btn btn-default btn-sm"><i class="fa fa-trash-o"></i></button>
                                    <button type="button" class="btn btn-default btn-sm"><i class="fa fa-reply"></i></button>
                                    <button type="button" class="btn btn-default btn-sm"><i class="fa fa-share"></i></button>
                                </div>
                                <!-- /.btn-group -->
                                <button type="button" class="btn btn-default btn-sm"><i class="fa fa-refresh"></i></button>
                                <div class="pull-right">
                                    1-50/200
                                    <div class="btn-group">
                                        <button type="button" class="btn btn-default btn-sm"><i class="fa fa-chevron-left"></i></button>
                                        <button type="button" class="btn btn-default btn-sm"><i class="fa fa-chevron-right"></i></button>
                                    </div>
                                    <!-- /.btn-group -->
                                </div>
                                <!-- /.pull-right -->
                            </div>
                        </div>
                    </div>
                    <!-- /. box -->
                </div>
                <!-- /.col -->
            </div>
            <!-- /.row -->



        </section>
        <!-- /.content -->
    </div>
    <!-- /.content-wrapper -->

    <navigation th:fragment="footer">
    <!-- Main Footer -->
    <footer class="main-footer">
        <!-- To the right -->
        <div class="pull-right hidden-xs">
            Think faster, do faster.
        </div>
        <!-- Default to the left -->
        <strong>Copyright &copy; 2016 <a href="#">Ruifu</a>.</strong> All rights reserved.
    </footer>

    <!-- Control Sidebar -->
    <aside class="control-sidebar control-sidebar-dark">
        <!-- Create the tabs -->
        <ul class="nav nav-tabs nav-justified control-sidebar-tabs">
            <li class="active"><a href="#control-sidebar-home-tab" data-toggle="tab"><i class="fa fa-home"></i></a></li>
            <li><a href="#control-sidebar-settings-tab" data-toggle="tab"><i class="fa fa-gears"></i></a></li>
        </ul>
        <!-- Tab panes -->
        <div class="tab-content">
            <!-- Home tab content -->
            <div class="tab-pane active" id="control-sidebar-home-tab">
                <h3 class="control-sidebar-heading">Recent Activity</h3>
                <ul class="control-sidebar-menu">
                    <li>
                        <a href="javascript:;">
                            <i class="menu-icon fa fa-birthday-cake bg-red"></i>

                            <div class="menu-info">
                                <h4 class="control-sidebar-subheading">Langdon's Birthday</h4>

                                <p>Will be 23 on April 24th</p>
                            </div>
                        </a>
                    </li>
                </ul>
                <!-- /.control-sidebar-menu -->

                <h3 class="control-sidebar-heading">Tasks Progress</h3>
                <ul class="control-sidebar-menu">
                    <li>
                        <a href="javascript:;">
                            <h4 class="control-sidebar-subheading">
                                Custom Template Design
                                <span class="pull-right-container">
                  <span class="label label-danger pull-right">70%</span>
                </span>
                            </h4>

                            <div class="progress progress-xxs">
                                <div class="progress-bar progress-bar-danger" style="width: 70%"></div>
                            </div>
                        </a>
                    </li>
                </ul>
                <!-- /.control-sidebar-menu -->

            </div>
            <!-- /.tab-pane -->
            <!-- Stats tab content -->
            <div class="tab-pane" id="control-sidebar-stats-tab">Stats Tab Content</div>
            <!-- /.tab-pane -->
            <!-- Settings tab content -->
            <div class="tab-pane" id="control-sidebar-settings-tab">
                <form method="post">
                    <h3 class="control-sidebar-heading">General Settings</h3>

                    <div class="form-group">
                        <label class="control-sidebar-subheading">
                            Report panel usage
                            <input type="checkbox" class="pull-right" checked="true"/>
                        </label>

                        <p>
                            Some information about this general settings option
                        </p>
                    </div>
                    <!-- /.form-group -->
                </form>
            </div>
            <!-- /.tab-pane -->
        </div>
    </aside>
    <!-- /.control-sidebar -->
    <!-- Add the sidebar's background. This div must be placed
         immediately after the control sidebar -->
    <div class="control-sidebar-bg"></div>
    </navigation>
</div>
<!-- ./wrapper -->
<navigation th:fragment="js">
<!-- REQUIRED JS SCRIPTS -->

<!-- jQuery 2.2.3 -->
<script th:src="@{/plugins/jQuery/jquery-2.2.3.min.js}"></script>
<!-- Bootstrap 3.3.6 -->
<script th:src="@{/bootstrap/js/bootstrap.js}"></script>
<!-- AdminLTE App -->
<script th:src="@{/dist/js/app.min.js}"></script>

<script th:src="@{/plugins/angular/angular.min.js}"></script>
<script th:src="@{/plugins/angular/angular-md5.min.js}"></script>

    <script th:src="@{/plugins/datepicker/bootstrap-datepicker.js}"></script>
    <script th:src="@{/plugins/datepicker/locales/bootstrap-datepicker.zh-CN.js }" charset="UTF-8"></script>
    <script th:src="@{/plugins/datepicker/locales/bootstrap-datepicker.zh.js }" charset="UTF-8"></script>
    <script th:src="@{/plugins/slimScroll/jquery.slimscroll.min.js}"></script>
    <script th:src="@{/plugins/fastclick/fastclick.js}"></script>
    <script th:src="@{/plugins/layer/layer.js}"></script>

<script th:src="@{/dist/js/common.js}"></script>

<script th:src="@{/plugins/daterangepicker/moment.js}"></script>
<script th:src="@{/plugins/daterangepicker/daterangepicker.js}"></script>

<script th:src="@{/plugins/jQuery/jquery.form.min.js}"></script>

<script th:src="@{/plugins/typeahead/bootstrap3-typeahead.min.js}"></script>
    <script th:src="@{/plugins/ckeditor/ckeditor.js}"></script>
    <script th:inline="javascript">
        /*<![CDATA[*/

        angular.module("pls",["commonService"]);

        angular.module("pls").directive("entersearch", function()
        {
            return {
                restrict : "A",
                scope : false,
                link : function(scope, element, attrs)
                {
                    $(element).keyup(function(e)
                    {
                        if (e.keyCode == 13)
                            scope.doSearch();
                    });
                }
            };
        });
        angular.module("pls").directive("timerangelimit", function() {
            return {
                restrict : "A",
                scope : false,
                link : function(scope, element, attrs) {
                    var endElement = $($(element).attr("timeRangeLimit"));
                    $(element).datepicker({
                        autoclose : true,
                        format : 'yyyy-mm-dd'
                    }).on("changeDate", function(e) {
                        var dateValue = $(element).datepicker("getDate");
                        endElement.datepicker("setStartDate", dateValue);
                    });
                    endElement.datepicker({
                        autoclose : true,
                        format : 'yyyy-mm-dd'
                    }).on("changeDate", function(e) {
                        var dateValue = endElement.datepicker("getDate");
                        $(element).datepicker("setEndDate", dateValue);
                    });
                }
            };
        });

        angular.module("pls", ["commonService"]).directive("pageTable", function($compile, httpService) {
            return {
                restrict : "A",
                link : function(scope, element, attrs) {
                    var children = $(element).children();
                    var arr = [];
                    for (var i = 0; i < children.length; i++) {
                        var v = $(children[i]);
                        var obj = {};
                        obj.title = v.html();
                        obj.column = v.attr("columnName");
                        if (v.attr("showColumnName")) {
                            obj.showColumn = v.attr("showColumnName");
                        }
                        if (v.attr("filter")) {
                            obj.filter = v.attr("filter");
                        }
                        arr.push(obj);
                    }

                    var templateArr = [];
                    templateArr.push('<div class="box box-danger">');
                    templateArr.push('<div class="box-header">');
                    templateArr.push('<h3 class="box-title">' + [[#{action.searchResultTitle}]] + '</h3>');
                    templateArr.push('</div>');
                    templateArr.push('<div class="box-body">');
                    templateArr.push('<table id="tableResult" class="table table-bordered table-hover .table-condensed">');
                    templateArr.push('<thead>');
                    templateArr.push('<tr>');

                    for (var i = 0; i < arr.length; i++) {
                        templateArr.push('<th class="sorting">');
                        templateArr.push('<span>' + arr[i].title + '</span>');
                        templateArr.push('<span class="pull-right"><i id="id_sort_icon_' + arr[i].column.replace("\.", "_") + '" class="fa fa-fw fa-sort" ng-click="sortBy(\'' + arr[i].column.replace("\.", "_") + '\')"></i></span>');
                        templateArr.push('</th>');
                    }

                    if (attrs.removeUrl) {
                        templateArr.push('<th>');
                        templateArr.push('<span>' + [[#{action.operation}]] + '</span>');
                        templateArr.push('</th>');
                    }

                    templateArr.push('</tr>');
                    templateArr.push('</thead>');


                    templateArr.push('<tbody>');
                    templateArr.push('<tr ng-repeat="m in dataList">');

                    for (var i = 0; i < arr.length; i++) {
                        var arrI = arr[i];
                        var col;
                        if (arrI.showColumn) {
                            col = arrI.showColumn;
                        } else {
                            col = arrI.column;
                        }

                        if (arrI.filter) {
                            col = col + " | " + arrI.filter;
                        }

                        if (i === 0) {
                            if (attrs.noUpdate === "true") {
                                templateArr.push("<td>{{m." + col + "}}</td>");
                            } else {
                                templateArr.push('<td><a href="javascript:void(0);" ng-click="openEditPopup(m, $event);">{{m.' + col + '}}</a></td>');
                            }
                        } else {
                            templateArr.push("<td>{{m." + col + "}}</td>");
                        }
                    }

                    //删除按钮
                    if (attrs.removeUrl) {
                        templateArr.push("<td>");
                        templateArr.push('<button ng-if="showDeleteButtonPerRow(m)" class="btn btn-danger" ng-click="openRemovePopup($index, m, $event)">' + [[#{action.delete}]] + '</button>');
                        templateArr.push("</td>");
                    }

                    templateArr.push('</tr>');
                    templateArr.push('</tbody>');
                    templateArr.push('</table>');

                    //分页
                    var paginationText = '<div class="box-footer clearfix">\
                                        <div class="form-group form-group-sm">\
                                            <div class="col-xs-5">\
                                                <span>共{{pagination.totalElements}}条，第{{pagination.number + 1}}页，共{{pagination.totalPages}}页</span>\
                                            </div>\
                                            <div class="col-xs-2">\
                                                <select id="id_size" ng-model="size" ng-change="changeSize()" class="form-control">\
                                                    <option ng-selected="true">10</option>\
                                                    <option>20</option>\
                                                    <option>50</option>\
                                                </select>\
                                            </div>\
                                            <div class="col-xs-5">\
                                                <ul class="pagination pagination-sm no-margin pull-right">\
                                                    <li ng-repeat="page in pagination.pages">\
                                                        <a href="javascript:void(0)" ng-click="gotoPage(page.page)">{{page.title}}</a>\
                                                    </li>\
                                                </ul>\
                                            </div>\
                                        </div>\
                                    </div>';


                    templateArr.push(paginationText);

                    templateArr.push('</div>');
                    templateArr.push('</div>');

                    //删除对话框
                    var removeModalText = '<div class="modal fade" id="remove_modal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel">\
                                        <div class="modal-dialog modal-sm" role="document" style="margin-top:300px;">\
                                            <div class="modal-content">\
                                                <div class="modal-header">\
                                                    <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>\
                                                    <h4 class="modal-title" id="id_remove_modal_title"></h4>\
                                                </div>\
                                                <div class="modal-footer">\
                                                    <button type="button" class="btn btn-default" data-dismiss="modal">' + [[#{action.close}]] + '</button>\
                                                    <button type="button" class="btn btn-primary" ng-click="removeItem()">' + [[#{action.confirm}]] + '</button>\
                                                </div>\
                                            </div>\
                                        </div>\
                                    </div>';
                    templateArr.push(removeModalText);

                    var template = templateArr.join("");
                    var linkFn = $compile(template);
                    var content = linkFn(scope);
                    $(element).html(content);

                    scope.page = 0;
                    scope.size = 10;
                    scope.sort = "";
                    scope.sortAscOrDesc = false;

                    var sortByMap = {};
                    for (var i = 0; i < arr.length; i++) {
                        sortByMap[arr[i].column] = false;
                    }
                    scope.sortByMap = sortByMap;

                    scope.sortBy = function(sortStr) {
                        scope.sort = sortStr;
                        scope.sortByMap[sortStr] = !scope.sortByMap[sortStr];
                        scope.sortAscOrDesc = scope.sortByMap[sortStr];
                        scope.loadItems();

                        for (var i in scope.sortByMap) {
                            $("#id_sort_icon_" + i).attr("class", "fa fa-fw fa-sort");
                            if (i == sortStr) {
                                $("#id_sort_icon_" + sortStr).attr("class", (scope.sortAscOrDesc ? "fa fa-fw fa-sort-asc" : "fa fa-fw fa-sort-desc"));
                            }
                        }
                    }
                    scope.gotoPage = function(page) {
                        scope.page = page;
                        scope.loadItems();
                    }
                    scope.changeSize = function() {
                        scope.loadItems();
                    }

                    scope.search = {};
                    scope.dataList = [];
                    scope.loadItems = function(){
                        httpService(attrs.pageListUrl, {page : scope.page, size : scope.size, sortStr : scope.sort, sortAscOrDesc : scope.sortAscOrDesc, 'searchObj' : JSON.stringify(scope.search)},function(json){
                            scope.dataList = json.content;
                            scope.pagination = getPagination(json);
                        });
                    }
                    scope.resetSearch = function(event) {
                        scope.search = {};
                    }
                    scope.doSearch = function(event) {
                        scope.loadItems();
                    }

                    scope.errorMsg = "";
                    scope.openRemovePopup = function($index, item) {
                        $("#id_remove_modal_title").html(attrs.removeAlert.replace("[]", "[" + item[attrs.removeAlertInfo] + "]"));
                        angular.element("#remove_modal").modal("show");
                        scope.removeId = item.id;
                    }
                    scope.removeItem = function() {
                        httpService(attrs.removeUrl + "/" + scope.removeId, {}, function(json) {
                            angular.element("#remove_modal").modal("hide");
                            scope.loadItems();
                        });
                    }

                    scope.showDeleteButtonPerRow = function(m) {
                        return true;
                    }

                    scope.init();

                    /*
                     必须实现$scope.openEditPopup() = function(item, event)
                     必须实现$scope.init()
                     */
                }
            }
        });

        angular.module("pls").directive("entersearch", function() {
            return {
                restrict : "A",
                scope : false,
                link : function(scope, element, attrs) {
                    $(element).keyup(function(e) {
                        if (e.keyCode == 13) {
                            scope.doSearch();
                        }
                    });
                }
            };
        });

        angular.module("pls").directive("timerangelimit", function() {
            /*var language = navigator.language;*/
            return {
                restrict : "A",
                scope : false,
                link : function(scope, element, attrs) {
                    var endElement = $($(element).attr("timerangelimit"));
                    $(element).datepicker({
                        autoclose : true,
                        format : 'yyyy-mm-dd'
                    }).on("changeDate", function(e) {
                        var dateValue = $(element).datepicker("getDate");
                        endElement.datepicker("setStartDate", dateValue);
                    });
                    endElement.datepicker({
                        autoclose : true,
                        format : 'yyyy-mm-dd'
                    }).on("changeDate", function(e) {
                        var dateValue = endElement.datepicker("getDate");
                        $(element).datepicker("setEndDate", dateValue);
                    });
                }
            };
        });

        function formatDate(date)
        {
            return date.getFullYear()+"-"+(date.getMonth()+1)+"-"+date.getDate();
        }
        /*]]>*/
    </script>
<!-- Optionally, you can add Slimscroll and FastClick plugins.
     Both of these plugins are recommended to enhance the
     user experience. Slimscroll is required when using the
     fixed layout. -->
<!--
<script th:inline="javascript">
    /*<![CDATA[*/
    var APP_TOKEN = [[${_csrf.token}]];
    var CURRENT_USER_ID =[[${user.id}]];
    angular.module("pls",["commonService"]);

    angular.module("pls").directive("importmodal", function($compile) {
        return {
            restrict : "A",
            scope : false,
            link : function(scope, element, attrs) {
                var importTitle = [[#{action.import}]];
                var closeText = [[#{action.close}]];
                var confirmText = [[#{action.confirm}]];
                $("#import_excel_modal_title").html(importTitle);
                $("#import_excel_modal_csrf").val(APP_TOKEN);
                $("#import_excel_modal_close_button").html(closeText);
                $("#import_excel_modal_confirm_button").html(confirmText);

                $("#import_excel_modal_select_data").val(attrs.importmodalselect);
                $("#import_excel_modal_url").val(attrs.importmodalurl);
                $("#import_excel_modal_require").val(attrs.importmodalrequire);
                $("#import_excel_modal_template_type").val(attrs.importmodaltemplatetype);
                $("#import_excel_modal_import_template_name").val(attrs.importmodalimporttemplatename);

                var template = '<button class="btn btn-success"\
                    ng-click="openImportPopup(null,$event);">' + [[#{action.import}]] + '</button>';
                var linkFn = $compile(template1);
                var content = linkFn(scope);
                $("#buttons").append(content);

                var template2 = '<button class="btn btn-warning pull-right"\
                    ng-click="exportImportExcel()">' + [[#{action.downloadImportTemplate}]] + '</button>';
                var linkFn2 = $compile(template2);
                var content2 = linkFn2(scope);
                $("#buttons").append(content2);

                scope.showExcel = function() {
                    var formData = new FormData($("#id_import_excel_form")[0]);
                    $.ajax({
                        url : "/excel/showExcel",
                        type : "POST",
                        data : formData,
                        async : true,
                        cache : false,
                        contentType : false,
                        processData : false,
                        success : function(returnData) {
                            $("#importPart").html(returnData);
//                            $("#import_excel_modal").modal("hide");
//                            location.hash = "import_excel_header";
                        },
                        error : function(returnData) {
                            alert(JSON.stringify(returnData));
                        }
                    });
                }

                scope.openImportPopup = function() {
                    angular.element("#import_excel_modal").modal("show");
                    $("#importPart").html("");
                }

                scope.exportImportExcel = function() {
                    $("#id_export_import_excel_form").submit();
                }
            },
            template : '<div class="modal fade" id="import_excel_modal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel">\
                            <div class="modal-dialog modal-lg" role="document">\
                                <div class="modal-content">\
                                    <div class="modal-header">\
                                        <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>\
                                        <h4 id="import_excel_modal_title" class="modal-title"></h4>\
                                    </div>\
                                    <div class="modal-body">\
                                        <form id="id_import_excel_form">\
                                            <div class="form-group">\
                                                <input name="importExcel" type="file" />\
                                                <br /><span style="color:red">支持后缀为xlsx的文件</span>\
                                            </div>\
                                            <input id="import_excel_modal_csrf" type="hidden" name="_csrf" />\
                                            <input id="import_excel_modal_select_data" type="hidden" name="selectData" />\
                                            <input id="import_excel_modal_require" type="hidden" name="requireField" />\
                                            <input id="import_excel_modal_url" type="hidden" name="importExcelUrl" />\
                                            <input id="import_excel_modal_template_type" type="hidden" name="templateType" />\
                                        </form>\
                                    </div>\
                                    <div class="modal-footer">\
                                        <button id="import_excel_modal_close_button" type="button" class="btn btn-default" data-dismiss="modal"></button>\
                                        <button id="import_excel_modal_confirm_button" type="button" class="btn btn-primary" ng-click="showExcel()"></button>\
                                    </div>\
                                </div>\
                                <div id="importPart"></div>\
                            </div>\
                        </div>\
                        <form style="display:none;" action="/download/excel/getImportExcel" id="id_export_import_excel_form">\
                            <input type="hidden" id="import_excel_modal_import_template_name" name="filename" value="" />\
                        </form>'
        }
    });

        angular.module("pls").directive("materialsearch", function()
        {
            return {
                restrict : "A",
                scope : false,
                link : function(scope, element, attrs)
                {
                    $(element).attr("autocomplete", "off");
                    $(element).attr("data-provide", "typeahead");
                    $(element).typeahead(
                        {
                            source : function(query, process)
                            {
                                var userInput = $(element).val();
                                if (userInput)
                                    $.post("/base/material/listBySkuOrName", {str : userInput, _csrf : APP_TOKEN}, function(json)
                                    {
                                        process(json);
                                    });
                            },
                            delay : 600,
                            items : 10,
                            displayText : function(item)
                            {
                                return item.sku + " " + item.name;
                            },
                            afterSelect : function(item)
                            {
                                scope.search.materialSku = item.sku;
                            }
                        });
                }
            };
        });

    angular.module("pls").directive("materialinput", function($compile) {
        return {
            restrict : "A",
            scope : false,
            link : function(scope, element, attrs) {
                $(element).attr("autocomplete", "off");
                $(element).attr("data-provide", "typeahead");

                $(element).typeahead({
                    source : function(query, process) {
                        var userInput = $(element).val();
                        if (userInput && userInput.length > 1) {
                            $.post("/base/material/listBySkuOrName", {
                                str: userInput,
                                _csrf: APP_TOKEN
                            }, function (json) {
                                if (json.length == 0) {
                                    scope.current.materialId = null;
                                }
                                process(json);
                            });
                        }
                    },
                    delay : 600,
                    items : 10,
                    displayText : function(item) {
                        return item.sku + " " + item.name;
                    },
                    afterSelect : function(item) {
                        scope.current.materialId = item.id;
                        scope.$apply();
                    }
                });

                $(element).wrap("<div class='input-group'></div>");

                var template = '<span class="input-group-btn">\
                    <button type="button" class="btn btn-warning" ng-click="showMaterialInputSearchModal()">...</button>\
                </span>';
                var linkFn = $compile(template1);
                var content = linkFn(scope);
                $(element).after(content);

                var template2 = '<div class="modal fade" id="materialInputSearchModal" data-backdrop="false" tabindex="-2" role="dialog">\
                                    <div class="modal-dialog" role="document">\
                                        <div class="modal-content">\
                                            <div class="modal-header">\
                                                <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>\
                                                <h4 class="modal-title">' + [[#{action.search}]] + '</h4>\
                                            </div>\
                                            <div class="modal-body">\
                                                <div class="row form form-horizontal">\
                                                    <div class="col-md-12">\
                                                        <div class="box box-primary">\
                                                            <div class="box-body">\
                                                                <div class="row">\
                                                                    <div class="col-md-5">\
                                                                        <div class="form-group">\
                                                                            <label for="materailInputSearchSku" class="control-label">' + [[#{common.sku}]] + '</label>\
                                                                            <input id="materailInputSearchSku" ng-keyup="materialInputSearchEnterSearch($event)" ng-model="materialInputSearch.materialSku" type="text" class="form-control" />\
                                                                        </div>\
                                                                    </div>\
                                                                    <div class="col-md-1">\
                                                                    </div>\
                                                                    <div class="col-md-5">\
                                                                        <div class="form-group">\
                                                                            <label for="materailInputSearchName" class="control-label">' + [[#{material.name}]] + '</label>\
                                                                            <input id="materailInputSearchName" ng-keyup="materialInputSearchEnterSearch($event)" ng-model="materialInputSearch.name" type="text" class="form-control" />\
                                                                        </div>\
                                                                    </div>\
                                                                    <div class="col-md-1">\
                                                                    </div>\
                                                                </div>\
                                                            </div>\
                                                            <div class="box-footer">\
                                                                <button class="btn btn-primary" ng-click="doMaterialInputSearch()">' + [[#{action.search}]] + '</button>\
                                                            </div>\
                                                        </div>\
                                                        <div class="box box-danger">\
                                                            <div class="box-header">\
                                                                <h3 class="box-title" th:text="#{action.searchResultTitle}">查询结果</h3>\
                                                            </div>\
                                                            <div class="box-body">\
                                                                <table class="table table-bordered table-hover">\
                                                                    <thead>\
                                                                        <tr>\
                                                                            <th>' + [[#{common.sku}]] + '</th>\
                                                                            <th>' + [[#{material.name}]] + '</th>\
                                                                            <th>' + [[#{material.description}]] + '</th>\
                                                                            <th>' + [[#{material.specific}]] + '</th>\
                                                                        </tr>\
                                                                    </thead>\
                                                                    <tbody>\
                                                                        <tr ng-repeat="item in materialInputSearchList" ng-click="materialInputSearchSelectRow(item)">\
                                                                            <td>{{item.sku}}</td>\
                                                                            <td>{{item.name}}</td>\
                                                                            <td>{{item.description}}</td>\
                                                                            <td>{{item.specific}}</td>\
                                                                        </tr>\
                                                                    </tbody>\
                                                                </table>\
                                                            </div>\
                                                        </div>\
                                                    </div>\
                                                </div>\
                                            </div>\
                                        </div>\
                                    </div>\
                                </div>';

                var linkFn2 = $compile(template2);
                var content2 = linkFn2(scope);
                $("div[ng-controller|=" + attrs.materialinput + "]").append(content2);

                scope.showMaterialInputSearchModal = function() {
                    scope.materialInputSearchList = [];
                    scope.materialInputSearch = {};
                    $("#materialInputSearchModal").modal("show");
                }

                scope.materialInputSearch = {};
                scope.materialInputSearchList = [];
                scope.doMaterialInputSearch = function() {
                    $.post("/base/material/materialInputSearch", {
                        searchObj : JSON.stringify(scope.materialInputSearch),
                        _csrf : APP_TOKEN
                    }, function (json) {
                        scope.materialInputSearchList = json;
                        scope.$apply();
                    });
                }

                scope.materialInputSearchSelectRow = function(item) {
                    scope.current.materialId = item.id;
                    scope.current.material.sku = item.sku;
                    $("#materialInputSearchModal").modal("hide");
                }

                scope.materialInputSearchEnterSearch = function($event) {
                    if ($event.keyCode == 13) {
                        scope.doMaterialInputSearch();
                    }
                }
            }
        }
    });

    angular.module("pls").directive("productioninput", function($compile) {
        return {
            restrict : "A",
            scope : false,
            link : function(scope, element, attrs) {
                $(element).attr("autocomplete", "off");
                $(element).attr("data-provide", "typeahead");

                $(element).typeahead({
                    source : function(query, process) {
                        var userInput = $(element).val();
                        if (userInput && userInput.length > 1) {
                            $.post("/base/production/listForTypeahead", {
                                str: userInput,
                                _csrf: APP_TOKEN
                            }, function (json) {
                                if (json.length == 0) {
                                    scope.current.productionId = null;
                                }
                                process(json);
                            });
                        }
                    },
                    delay : 600,
                    items : 10,
                    displayText : function(item) {
                        return item.sku + " " + item.name;
                    },
                    afterSelect : function(item) {
                        scope.current.productionId = item.id;
                        scope.$apply();
                    }
                });

                $(element).wrap("<div class='input-group'></div>");

                var template = '<span class="input-group-btn">\
                    <button type="button" class="btn btn-warning" ng-click="showProductionInputSearchModal()">...</button>\
                </span>';
                var linkFn = $compile(template1);
                var content = linkFn(scope);
                $(element).after(content);

                var template2 = '<div class="modal fade" id="productionInputSearchModal" data-backdrop="false" tabindex="-2" role="dialog">\
                                    <div class="modal-dialog" role="document">\
                                        <div class="modal-content">\
                                            <div class="modal-header">\
                                                <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>\
                                                <h4 class="modal-title">' + [[#{action.search}]] + '</h4>\
                                            </div>\
                                            <div class="modal-body">\
                                                <div class="row form form-horizontal">\
                                                    <div class="col-md-12">\
                                                        <div class="box box-primary">\
                                                            <div class="box-body">\
                                                                <div class="row">\
                                                                    <div class="col-md-5">\
                                                                        <div class="form-group">\
                                                                            <label for="productionInputSearchSku" class="control-label">' + [[#{common.sku}]] + '</label>\
                                                                            <input id="productionInputSearchSku" ng-keyup="productionInputSearchEnterSearch($event)" ng-model="productionInputSearch.sku" type="text" class="form-control" />\
                                                                        </div>\
                                                                    </div>\
                                                                    <div class="col-md-1">\
                                                                    </div>\
                                                                    <div class="col-md-5">\
                                                                        <div class="form-group">\
                                                                            <label for="productionInputSearchName" class="control-label">' + [[#{material.name}]] + '</label>\
                                                                            <input id="productionInputSearchName" ng-keyup="productionInputSearchEnterSearch($event)" ng-model="productionInputSearch.name" type="text" class="form-control" />\
                                                                        </div>\
                                                                    </div>\
                                                                    <div class="col-md-1">\
                                                                    </div>\
                                                                </div>\
                                                            </div>\
                                                            <div class="box-footer">\
                                                                <button class="btn btn-primary" ng-click="doProductionInputSearch()">' + [[#{action.search}]] + '</button>\
                                                            </div>\
                                                        </div>\
                                                        <div class="box box-danger">\
                                                            <div class="box-header">\
                                                                <h3 class="box-title" th:text="#{action.searchResultTitle}">查询结果</h3>\
                                                            </div>\
                                                            <div class="box-body">\
                                                                <table class="table table-bordered table-hover">\
                                                                    <thead>\
                                                                        <tr>\
                                                                            <th>' + [[#{common.sku}]] + '</th>\
                                                                            <th>' + [[#{production.name}]] + '</th>\
                                                                            <th>' + [[#{production.description}]] + '</th>\
                                                                        </tr>\
                                                                    </thead>\
                                                                    <tbody>\
                                                                        <tr ng-repeat="item in productionInputSearchList" ng-click="productionInputSearchSelectRow(item)">\
                                                                            <td>{{item.sku}}</td>\
                                                                            <td>{{item.name}}</td>\
                                                                            <td>{{item.description}}</td>\
                                                                        </tr>\
                                                                    </tbody>\
                                                                </table>\
                                                            </div>\
                                                        </div>\
                                                    </div>\
                                                </div>\
                                            </div>\
                                        </div>\
                                    </div>\
                                </div>';

                var linkFn2 = $compile(template2);
                var content2 = linkFn2(scope);
                $("div[ng-controller|=" + attrs.productioninput + "]").append(content2);

                scope.showProductionInputSearchModal = function() {
                    scope.productionInputSearchList = [];
                    scope.productionInputSearch = {};
                    $("#productionInputSearchModal").modal("show");
                }

                scope.productionInputSearch = {};
                scope.productionInputSearchList = [];
                scope.doProductionInputSearch = function() {
                    $.post("/base/production/productionInputSearch", {
                        searchObj : JSON.stringify(scope.productionInputSearch),
                        _csrf : APP_TOKEN
                    }, function (json) {
                        scope.productionInputSearchList = json;
                        scope.$apply();
                    });
                }

                scope.productionInputSearchSelectRow = function(item) {
                    scope.current.productionId = item.id;
                    scope.current.production.sku = item.sku;
                    $("#productionInputSearchModal").modal("hide");
                }

                scope.productionInputSearchEnterSearch = function($event) {
                    if ($event.keyCode == 13) {
                        scope.doProductionInputSearch();
                    }
                }
            }
        }
    });

    angular.module("pls").directive("vendorInput", function($compile) {
        return {
            restrict : "A",
            scope : false,
            link : function(scope, element, attrs) {
                $(element).wrap("<div class='input-group'></div>");

                var template = '<span class="input-group-btn">\
                    <button type="button" class="btn btn-warning" ng-click="showVendorInputSearchModal()">...</button>\
                </span>';
                var linkFn = $compile(template1);
                var content = linkFn(scope);
                $(element).after(content);

                var template2 = '<div class="modal fade" id="vendorInputSearchModal" tabindex="-2" role="dialog">\
                                    <div class="modal-dialog" role="document">\
                                        <div class="modal-content">\
                                            <div class="modal-header">\
                                                <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>\
                                                <h4 class="modal-title">' + [[#{action.search}]] + '</h4>\
                                            </div>\
                                            <div class="modal-body">\
                                                <div class="row form form-horizontal">\
                                                    <div class="col-md-12">\
                                                        <div class="box box-primary">\
                                                            <div class="box-body">\
                                                                <div class="row">\
                                                                    <div class="col-md-5">\
                                                                        <div class="form-group">\
                                                                            <label for="vendorInputSearchName" class="control-label">' + [[#{vendor.name}]] + '</label>\
                                                                            <input id="vendorInputSearchName" ng-keyup="vendorInputSearchEnterSearch($event)" ng-model="vendorInputSearch.name" type="text" class="form-control" />\
                                                                        </div>\
                                                                    </div>\
                                                                    <div class="col-md-1">\
                                                                    </div>\
                                                                </div>\
                                                            </div>\
                                                            <div class="box-footer">\
                                                                <button class="btn btn-primary" ng-click="doVendorInputSearch()">' + [[#{action.search}]] + '</button>\
                                                            </div>\
                                                        </div>\
                                                        <div class="box box-danger">\
                                                            <div class="box-header">\
                                                                <h3 class="box-title" th:text="#{action.searchResultTitle}"></h3>\
                                                            </div>\
                                                            <div class="box-body">\
                                                                <table class="table table-bordered table-hover">\
                                                                    <thead>\
                                                                        <tr>\
                                                                            <th><input id="vendorInputCheckbox" type="checkbox" ng-click="vendorInputCheckboxClick($event)" /></th>\
                                                                            <th>' + [[#{vendor.name}]] + '</th>\
                                                                            <th>' + [[#{vendor.phone}]] + '</th>\
                                                                            <th>' + [[#{vendor.address1}]] + '</th>\
                                                                        </tr>\
                                                                    </thead>\
                                                                    <tbody>\
                                                                        <tr ng-repeat="item in vendorInputSearchList">\
                                                                            <td><input ng-model="item.selected" type="checkbox" /></td>\
                                                                            <td>{{item.name}}</td>\
                                                                            <td>{{item.phone}}</td>\
                                                                            <td>{{item.address1}}</td>\
                                                                        </tr>\
                                                                    </tbody>\
                                                                </table>\
                                                            </div>\
                                                            <div class="box-footer pull-right">\
                                                                <button type="button" class="btn btn-default" data-dismiss="modal">' + [[#{action.close}]] + '</button>&nbsp;\
                                                                <button type="button" class="btn btn-primary" ng-click="vendorInputSearchSelectRow();">' + [[#{action.confirm}]] + '</button>\
                                                            </div>\
                                                        </div>\
                                                    </div>\
                                                </div>\
                                            </div>\
                                        </div>\
                                    </div>\
                                </div>';

                var linkFn2 = $compile(template2);
                var content2 = linkFn2(scope);
                $("div[ng-controller|=" + attrs.vendorInput + "]").append(content2);

                scope.showVendorInputSearchModal = function() {
                    scope.vendorInputSearchList = [];
                    scope.vendorInputSearch = {};
                    $("#vendorInputCheckbox").prop("checked", false);
                    $("#vendorInputSearchModal").modal("show");
                }

                scope.vendorInputSearch = {};
                scope.vendorInputSearchList = [];
                scope.doVendorInputSearch = function() {
                    $.post("/base/vendor/listByPage", {
                        searchObj : JSON.stringify(scope.vendorInputSearch),
                        page : 0,
                        size : 999,
                        _csrf : APP_TOKEN
                    }, function (json) {
                        scope.vendorInputSearchList = json.content;
                        scope.$apply();
                    });
                }

                scope.vendorInputSearchSelectRow = function() {
                    var tmpArrIds = [];
                    var tmpArrNames = [];
                    for (var i = 0; i < scope.vendorInputSearchList.length; i++) {
                        if (scope.vendorInputSearchList[i].selected) {
                            tmpArrIds.push(scope.vendorInputSearchList[i].id);
                            tmpArrNames.push(scope.vendorInputSearchList[i].name);
                        }
                    }

                    scope.current.vendorNames = tmpArrNames.join(",");
                    scope.current.vendorIds = tmpArrIds.join(",");

                    $("#vendorInputSearchModal").modal("hide");
                }

                scope.vendorInputCheckboxClick = function() {
                    var checked;
                    if ($("#vendorInputCheckbox").prop("checked")) {
                        checked = true;
                    } else {
                        checked = false;
                    }

                    for (var i = 0; i < scope.vendorInputSearchList.length; i++) {
                        scope.vendorInputSearchList[i].selected = checked;
                    }
                }

                scope.vendorInputSearchEnterSearch = function($event) {
                    if ($event.keyCode == 13) {
                        scope.doVendorInputSearch();
                    }
                }
            }
        }
    });

    angular.module("pls").directive("customlinesetting", function($compile)
    {
        return {
            restrict : "A",
            scope : false,
            link : function(scope, element, attrs)
            {
                var templateBtn = ' <button class="btn btn-warning"\
                    ng-click="showCustomLineSettingModal();">' + [[#{action.setting}]] + '</button>';
                var linkFnBtn = $compile(templateBtn);
                var contentBtn = linkFnBtn(scope);
                $("#buttons").append(contentBtn).append("\n");
                var template2 ='<div class="modal fade" id="customLineSetting" data-backdrop="false" tabindex="-1" role="dialog">\
                                    <div class="modal-dialog" role="document">\
                                        <div class="modal-content">\
                                            <div class="modal-header">\
                                                <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>\
                                                <h4 class="modal-title">' + [[#{custom.customLineTitle}]] + '</h4>\
                                            </div>\
                                            <div class="modal-body">\
                                                <div class="row form form-horizontal">\
                                                    <div class="col-md-12">\
                                                        <div class="box box-danger">\
                                                            <div class="box-body">\
                                                                <table class="table table-bordered table-hover">\
                                                                    <thead>\
                                                                        <tr>\
                                                                            <th class="sorting">' + [[#{custom.fieldName}]] + '</th>\
                                                                            <th class="sorting">' + [[#{custom.customFieldName}]] + '</th>\
                                                                            <th class="sorting">自定义日期格式</th>\
                                                                            <th class="sorting">\
                                                                                <input type="checkbox" ng-model="itemsVisibleSelected" ng-click="selectVisibleAll($event)"/>\
                                                                            ' + [[#{custom.visible}]] + '\
                                                                            </th>\
                                                                            <th class="sorting">\
                                                                                <input type="checkbox" ng-model="itemsSortSelected" ng-click="selectSortAll($event)"/>\
                                                                            ' + [[#{custom.whetherSort}]] + '\
                                                                            </th>\
                                                                        </tr>\
                                                                    </thead>\
                                                                    <tbody>\
                                                                        <tr ng-repeat="item in customLine_items">\
                                                                            <td>{{item.fieldName}}</td>\
                                                                            <td><input  type="text" ng-model="item.customFieldName" class="form-control" /></td>\
                                                                            <td><input  type="text" ng-model="item.customDateFormat" class="form-control" /></td>\
                                                                            <td><input  type="checkbox" ng-model="item.visible" /></td>\
                                                                            <td><input  type="checkbox" ng-model="item.whetherSort" /></td>\
                                                                        </tr>\
                                                                    </tbody>\
                                                                </table>\
                                                                <div id="content" style="display:none;" >'+[[#{custom.noData}]]+'</div>\
                                                            </div>\
                                                        <div class="modal-footer">\
                                                            <button type="button" class="btn btn-default" data-dismiss="modal" th:text="#{action.close}">Close</button>\
                                                            <button type="button" class="btn btn-primary" id="saveSetting" ng-click="saveSetting($event);">'+[[#{action.save}]]+'</button>\
                                                        </div>\
                                                        </div>\
                                                    </div>\
                                                </div>\
                                            </div>\
                                        </div>\
                                    </div>\
                                </div>' ;
                var linkFn2 = $compile(template2);
                var content2 = linkFn2(scope);
                $("div[ng-controller|=" + attrs.customlinesetting + "]").append(content2);

                scope.showCustomLineSettingModal = function() {
                    $("#saveSetting").removeAttr("disabled");
                    if(scope.customLine_items.length<=0){
                        $("#content").css("display","");
                        $("#saveSetting").attr("disabled","disabled");
                    }
                    $("#customLineSetting").modal("show");

                }

                scope.saveSetting = function() {
                    $.post("/customLine/customLineDetail/addList", {
                        item : JSON.stringify(scope.customLine_items),
                        _csrf : APP_TOKEN
                    }, function (json) {
                        $("#customLineSetting").modal("hide");
                        scope.loadItems();
                    });
                }

                scope.itemsVisibleSelected = true;
                scope.selectVisibleAll = function(event){
                    var selected = scope.itemsVisibleSelected;
                    for(var i=0;i<scope.customLine_items.length;i++){
                        scope.customLine_items[i].visible = selected;
                    }
                }

                scope.itemsSortSelected = true;
                scope.selectSortAll = function(event){
                    var selected = scope.itemsSortSelected;
                    for(var i=0;i<scope.customLine_items.length;i++){
                        scope.customLine_items[i].whetherSort = selected;
                    }
                }
            }
        };
    });
    angular.module("pls").directive("timedropdownmenu", function($compile)
    {
        var markNumber = 0;
        return {
            restrict : "A",
            scope : false,
            link : function(scope, element, attrs)
            {
                scope.createUl = function (json)
                {
                    var temple = '<ul class="dropdown-menu" id="timeDropMenu">';
                    var text;
                    var parameter;
                    for(var i = 0; i < json.length; i++){
                        if(0 == json[i].dateNumber){
                            text = ""+json[i].dateName+"";
                            parameter = ""+0+','+1+','+0+"";
                        }else {
                            text  = ""+json[i].dateName+json[i].dateNumber+json[i].unitName+"";
                            parameter = ""+json[i].dateNumber+','+json[i].dateMark+','+json[i].unitMark+""
                        }
                        temple+= '<li><a href="#" ng-click="anyday($event,'+parameter+')" style="height: 25px" th:text="#{production_plan.today}">'+text+'</a></li>';
                    }
                    temple += ' </ul>';
                    var linkFn = $compile(temple);
                    var content = linkFn(scope);
                    $("div[name='dateDropMenuDiv']").append("\n").append(content);
                }
                scope.doDateSearch = function()
                {
                    $.post("/base/serch/list", {
                        _csrf : APP_TOKEN
                    }, function (json) {
                        scope.createUl(json);
                    });
                }
                scope.doDateSearch();
                scope.fillDate = function (event) {
                    if(0 == markNumber){
                        $("input[name='startDate']").datepicker("setDate",new Date());
                        $("input[name='endDate']").datepicker("setDate", new Date());
                    }
                    markNumber += 1;
                }
                scope.calculateTime = function (Number,strInterval)
                {
                    var dtTmp =new Date();
                    switch (strInterval) {
                        case 'second':
                        case 's' :
                            return new Date(Date.parse(dtTmp) + (1000 * Number));
                        case 'minute':
                        case 'n' :
                            return new Date(Date.parse(dtTmp) + (60000 * Number));
                        case 'hour':
                        case 'h' :
                            return new Date(Date.parse(dtTmp) + (3600000 * Number));
                        case 'day':
                        case 'd' :
                        case 0 :
                            return new Date(Date.parse(dtTmp) + (86400000 * Number));
                        case 'week':
                        case 'w' :
                        case 1 :
                            return new Date(Date.parse(dtTmp) + ((86400000 * 7) * Number));
                        case 'month':
                        case 'm' :
                            return new Date(dtTmp.getFullYear(), (dtTmp.getMonth()) + Number, dtTmp.getDate(), dtTmp.getHours(), dtTmp.getMinutes(), dtTmp.getSeconds());
                        case 'year':
                        case 'y' :
                            return new Date((dtTmp.getFullYear() + Number), dtTmp.getMonth(), dtTmp.getDate(), dtTmp.getHours(), dtTmp.getMinutes(), dtTmp.getSeconds());
                    }
                }
                scope.getAnyDay = function (number,str)
                {
                    var today = new Date();
                    today= 1900+today.getYear()+"-"+(today.getMonth()+1)+"-"+today.getDate();
                    today = today.valueOf();
                    var anotherday = scope.calculateTime(number,str)
                    anotherday= 1900+anotherday.getYear()+"-"+(anotherday.getMonth()+1)+"-"+anotherday.getDate();
                    var myArray=new Array();
                    myArray[0]=today;
                    myArray[1]=anotherday;
                    return myArray;
                }
                scope.changeTimeButtonText = function changeTimeButtonText(event)
                {
                    var s = $("button[name='dateChoice']");
                    var text = event.currentTarget.innerText;
                    for(var i=0; i<s.length; i++){
                        s[i].innerText=text;
                    }
                }
                scope.anyday = function (event,number,dateMark,unitMark)
                {
                    scope.changeTimeButtonText(event);
                    markNumber += 1;
                    var arrayDate;
                    if(dateMark != 0){
                        arrayDate = scope.getAnyDay(number,unitMark);
                        $("input[name='startDate']").datepicker("setDate", arrayDate[0]);
                        $("input[name='endDate']").datepicker("setDate", arrayDate[1]);
                    }else{
                        number = 0-number;
                        arrayDate = scope.getAnyDay(number,unitMark);
                        $("input[name='startDate']").datepicker("setDate", arrayDate[1]);
                        $("input[name='endDate']").datepicker("setDate", arrayDate[0]);
                    }
                    scope.loadItems();
                }
                scope.resetTimeButtonText = function (event)
                {
                    var s = $("button[name='dateChoice']");
                    for(var i=0; i<s.length; i++){
                        s[i].innerText="无";
                    }
                }
            }
        };
    });
    //编辑器的指令
    angular.module("pls").directive('ckeditor', function() {
        return {
            require : '?ngModel',
            link : function(scope, element, attrs, ngModel) {
                var ckeditor = CKEDITOR.replace(element[0], {
                    filebrowserUploadUrl:"/base/file/uploadImage?_csrf="+APP_TOKEN
                });
                if (!ngModel) {
                    return;
                }
                ckeditor.on('instanceReady', function() {
                    ckeditor.setData(ngModel.$viewValue);
                });
                ckeditor.on('pasteState', function() {
                    scope.$apply(function() {
                        ngModel.$setViewValue(ckeditor.getData());
                    });
                });
                ngModel.$render = function(value) {
                    ckeditor.setData(ngModel.$viewValue);
                };
            }
        };
    });

    /*]]>*/
</script>
-->
    <!--<script th:src="@{/dist/js/menu.js}"></script>-->
    <script th:src="@{/dist/js/sweetalert2.min.js}"></script>
</navigation>

<navigation th:fragment="paging">
    <div class="box-footer clearfix">
        <div class="form-group form-group-sm">
            <div class="col-xs-5">
                <span>共{{pagination.totalElements}}条，第{{pagination.number + 1}}页，共{{pagination.totalPages}}页</span>
            </div>
            <div class="col-xs-2">
                <select id="id_size" ng-model="size" ng-change="changeSize()" class="form-control">
                    <option ng-selected="true">10</option>
                    <option>20</option>
                    <option>50</option>
                </select>
            </div>
            <div class="col-xs-5">
                <ul class="pagination pagination-sm no-margin pull-right">
                    <li ng-repeat="page in pagination.pages">
                        <a href="javascript:void(0)" ng-click="gotoPage(page.page)">{{page.title}}</a>
                    </li>
                </ul>
            </div>
        </div>
    </div>
</navigation>

<navigation th:fragment="config">
    <div class="checkbox">
        <label>
            <input type="checkbox" ng-model="config.sentAllToFinishAsn"/>
            发货结束则结束ASN
        </label>
    </div>

    <div class="checkbox">
        <label>
            <input type="checkbox" ng-model="config.sentAllToFinishOrder"/>
            发货结束则结束采购订单
        </label>
    </div>

    <div class="checkbox">
        <label>
            <input type="checkbox" ng-model="config.allowNotFullBoxToSend"/>
            允许不满箱发货
        </label>
    </div>
    <div class="checkbox">
        <label>
            <input type="checkbox" ng-model="config.allowVendorLookProductionPlan"/>
            允许供应商查看生产计划
        </label>
    </div>
    <div class="checkbox">
        <label>
            <input type="checkbox" ng-model="config.allowVendorLookOrderPlan"/>
            允许供应商查物料采购计划
        </label>
    </div>
    <div class="checkbox">
        <label>
            <input type="checkbox" ng-model="config.allowOrderToMultipleAsn"/>
            一个订单允许被拆分多个ASN
        </label>
    </div>
    <div class="checkbox">
        <label>
            <input type="checkbox" ng-model="config.allowAsnIncludeMaterialNotInOrder"/>
            ASN单可以包含不在订单内的物料
        </label>
    </div>
    <div class="checkbox">
        <label>
            <input type="checkbox" ng-model="config.allowAsnQuantityOverOrder"/>
            ASN单可以超发
        </label>
        <span class="help-block">供应商创建ASN单的时候，允许供应物料的数量超过订单的数量, 超发比例<input type="number" min="0" style="width:60px" ng-model="config.asnOverPercent" />%</span>
    </div>

    <div class="checkbox">
        <label>
            <input type="checkbox" ng-model="config.allowAsnRequiredDateBiggerThanDetailRequiredDate"/>
            是否允许ASN单预期到货日期大于明细中的最小日期
        </label>
    </div>

    <div class="checkbox">
        <label>
            <input type="checkbox" ng-model="config.allowAsnDifferentAddress"/>
            是否允许ASN单明细中存在不同地址
        </label>
    </div>
</navigation>

<navigation th:fragment="configCode">
    采购订单码生成规则:
    <select class="form-control" ng-model="config.purchaseOrderEventId" ng-options="eve.id as eve.name for eve in events">
        <option value="">默认</option>
    </select>

    ASN码生成规则:
    <select class="form-control" ng-model="config.asnEventId" ng-options="eve.id as eve.name for eve in events">
        <option value="">默认</option>
    </select>

    箱码生成规则:
    <select class="form-control" ng-model="config.boxEventId" ng-options="eve.id as eve.name for eve in events">
        <option value="">默认</option>
    </select>
</navigation>


</body>
</html>